﻿Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports BBDD
Imports Controladores

 _

Class cancelarAcc
   Inherits System.Web.UI.Page
   
   Protected Sub Page_Load(sender As Object, e As EventArgs)
      
      If Session("privUser") Is Nothing Or Integer.Parse(Session("privUser").ToString()) < 1 Then
         Response.Redirect("index.aspx")
      End If
      
      
      Me.campoDNI.Text = Session("DNIUser").ToString()
      Me.campoDNI.Enabled = False
      
      
        listaPendientes.Value = "Compras:" + vbcrlf + " " + Consultas.listarCompras(1, Session("DNIUser").ToString(), 0) + vbcrlf + "Ventas:" + vbcrlf + Consultas.listarVenta(1, Session("DNIUser").ToString())
   End Sub 'Page_Load
   
   
   Protected Sub boton_cancelar_Click(sender As Object, e As EventArgs)
      If Me.ComprasOVenta.Value.ToString() = "Compras" Then
         If Consultas.cancelarOrdenCompras(campoID.Text.ToString()) Then
            controlador.CreateMessageAlert(Me, "Operacion llevada con éxito", "msg")
            End If
         controlador.CreateMessageAlert(Me, "No se ha podido cancelar la compra", "msg")
      Else
         If Consultas.cancelarOrdenVenta(campoID.Text.ToString()) Then
            controlador.CreateMessageAlert(Me, "Operacion llevada con éxito", "msg")
            End If
         
         controlador.CreateMessageAlert(Me, "No se ha podido cancelar la venta", "msg")
      End If 
   End Sub 'boton_cancelar_Click
End Class 'cancelarAcc

